<!DOCTYPE HTML>
<html lang="en">
<head>
    <title>订单详情</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <!-- jquery -->
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <!-- bootstrap -->
    <link rel="stylesheet" type="text/css" href="/bootstrap/css/bootstrap.min.css" />
    <script type="text/javascript" src="/bootstrap/js/bootstrap.min.js"></script>
    <!-- jquery-validator -->
    <script type="text/javascript" src="/jquery-validation/jquery.validate.min.js"></script>
    <script type="text/javascript" src="/jquery-validation/localization/messages_zh.min.js"></script>
    <!-- layer -->
    <script type="text/javascript" src="/layer/layer.js"></script>
    <!-- md5.js -->
    <script type="text/javascript" src="/js/md5.min.js"></script>
    <!-- common.js -->
    <script type="text/javascript" src="/js/common.js"></script>
</head>
<body>
<div class="panel panel-default">
  <div class="panel-heading">恭喜你成功秒杀到商品，现在已进入秒杀订单详情</div>
  <table class="table" id="goodslist">
        <tr>  
        <td>商品名称</td>  
        <td id="goodsName" colspan="3"></td> 
     </tr>  
     <tr>  
        <td>商品图片</td>  
        <td colspan="2"><img id="goodsImg" width="200" height="200" /></td>  
     </tr>
      <tr>  
        <td>订单价格</td>  
        <td colspan="2" id="goodsPrice"></td>  
     </tr>
     <tr>
     		<td>下单时间</td>  
        	<td id="createDate" colspan="2"></td>  
     </tr>
     <tr>
     	<td>订单状态</td>  
        <td id="status">
<!--        	<span if="${orderInfo.status eq 0}">未支付</span>-->
<!--        	<span if="${orderInfo.status eq 1}">待发货</span>-->
<!--        	<span if="${orderInfo.status eq 2}">已发货</span>-->
<!--        	<span if="${orderInfo.status eq 3}">已收货</span>-->
<!--        	<span if="${orderInfo.status eq 4}">已退款</span>-->
<!--        	<span if="${orderInfo.status eq 5}">已完成</span>-->
        </td>  
        <td>
        	<button class="btn btn-primary btn-block" type="submit" id="payButton">立即支付</button>
        </td>
     </tr>
      <tr>
     		<td>收货人</td>  
        	<td colspan="2">zgc  110</td>
     </tr>
     <tr>
     		<td>收货地址</td>  
        	<td colspan="2">陕西省西安市</td>
     </tr>
  </table>
</div>

<script>
    $(function (){
        getOrderDetail();
    })
    function getOrderDetail() {
        let orderId = g_getQueryString("orderId");
        $.ajax({
            url: "/order/detail?orderId="+orderId,
            type:"GET",
            success:function (data){
                console.log(data)
                if (data.code ==200){
                    $("#goodsName").text(data.data.goodsVo.goodsName)
                    $("#goodsImg").attr("src",data.data.goodsVo.goodsImg)
                    $("#goodsPrice").text(data.data.goodsVo.seckillPrice)
                    $("#createDate").text(new Date(data.data.goodsVo.startDate).format("yyyy-MM-dd hh:mm"))
                    if (data.data.orderInfo.status==0){
                        $("#status").text("未支付")
                    }
                    if (data.data.orderInfo.status==1){
                        $("#status").text("待发货")
                    }
                    if (data.data.orderInfo.status==2){
                        $("#status").text("已发货")
                    }
                    if (data.data.orderInfo.status==3){
                        $("#status").text("已收货")
                    }
                    if (data.data.orderInfo.status==4){
                        $("#status").text("已退款")
                    }
                    if (data.data.orderInfo.status==5){
                        $("#status").text("已完成")
                    }
                }else {
                    layer.msg(data.msg)
                }
            },
            error(data){
                layer.msg(data.msg)
            }
        })
        
    }
</script>
</body>
</html>
